<?php
class SettingsForm extends MForm {
    
    public function __construct() {
        parent::__construct(__route('ml-admin/setting/default'));
        $this->setMethod(self::METHOD_POST);
        
        $this->add(self::ELEMENT_TEXT, 'mandrill.title')
                ->setLabel(__t('mandrill.admin.settings.form.mandrillTitle'));
        $select = $this->add(self::ELEMENT_SELECT, 'mandrill.defaultModule')
                ->setLabel(__t('mandrill.admin.settings.form.mandrillDefaultModule'));

        $modules = Module::all();
        foreach ($modules as $module) {
            $select->addOption($module->name)
                    ->setValue($module->name)
                    ->setLabel($module->name);
        }

        $this->add(self::ELEMENT_SUBMIT, 'settingsSubmit')
                ->setValue(__t('mandrill.admin.settings.form.submit'));
    }
}
?>
